﻿using UnityEngine;
using System.Collections;

public class Door2 : MonoBehaviour 
{

	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
	
	}
	
	void OnTriggerEnter(Collider other)
	{
		if(Player.have_key_brass || Player.have_key_silver || Player.have_key_gold)
		{
			if(other.gameObject.tag == "Player")
			{
				if(Player.have_key_gold)
				{
					Player.score += 1000;
				}
				else if(Player.have_key_silver)
				{
					Player.score += 3000;
				}

				else
				{
					Player.score += 10000;
				}
			}

			Application.LoadLevel("Game_Win");

		



		}	
		
		else
		{
			print("você prescisa da chave");
			text_from_door.show_text = true;
		}
	}
}
